<%--
 *  File:    VisitProcessDetailInfo.jsp
 *  @Author: liangchen
 *  Date:    2009-10-10

 *  Copyright (C) 2000 - 2009 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java"%>
<%@ page import="java.util.*"%>
<%@ page import="org.apache.log4j.Category"%>
<%@ page import="com.oval.util.OvalLabel"%>
<%@ page import="com.oval.util.OvalCustomMessage"%>
<%@ page import="com.oval.util.OvalCustomColumn"%>

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval"%>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom"%>

<%
  //init param
  String privilegeCode = "H0252";
  String strModuleName = "CRM";
%>
<%
  HashMap userinfo = new HashMap();
  userinfo = (HashMap)session.getAttribute("userinfo");
  Integer orgid=new Integer(-1);
  String neworgid = null;
  if(userinfo.get("orgid")!=null)
  orgid = (Integer)userinfo.get("orgid");
  neworgid = orgid.toString();
    System.out.println("Trace \"isdefault\" ------- detail"+request.getParameter("isdefault"));
  	String strIsDefault = null;
	if("Y".equals(request.getParameter("isdefault"))) {
		strIsDefault = "&isdefault=Y";
	}else if ("N".equals(request.getParameter("isdefault"))) {
		strIsDefault = "&isdefault=N";
	}else  {
		strIsDefault = null;
	}
%>
<%
		Vector actioninfo = (Vector)(pageContext.getAttribute("actioninfo"));
%>
<%@ include file="/inc/Security.inc"%>
<%@ include file="/inc/PageDefault.inc"%>
<%@include file="/inc/Print.inc"%>
<%@ include file="/inc/FrmDefault.inc"%>
<iframe name="reloadHandler" style="display:none" ></iframe>
<html>
	<head>
		<title>VisitProcessDetailInfo</title>
		
		<PageFlow:CheckPageFlow pageName="p_visitprocessdetailedit" />
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link rel="stylesheet" href="../css/<%= strLanguageCode %>/main.css"
			type="text/css">
		<script language="JavaScript"
			src="../css/<%= strLanguageCode %>/script.js"></script>
		<script language="JavaScript" src="../js/FuncLib.js"></script>
		<script language="JavaScript" src="../js/ScriptLib.js"></script>
		<script language="JavaScript" src="../js/keyFunction.js"></script>
		<script language="JavaScript" src="../js/Calendar.js"></script>
		<%@ include file="/inc/SummaryDivision.inc"%>
		<script>

var popwindow;
function page_selectactionid()
{

  if(popwindow!=null)
    popwindow.close();
  popwindow = window.open('ActionItemSelectPop.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode%>','newwindow', 'height=350, width=850,top=150,left=300,toolbar=n0, menubar=no, scrollbars=no, resizable=no, location=no, status=no');
}
function page_setactionid(actionid,actioncode,actionname,description,needfeedback,valuename,needsku,feedbacktype)
{
  document.actionsummaryform.visitprocessactionid.value = actionid;
  document.actionsummaryform.actioncode.value = actioncode;
  document.actionsummaryform.actionname.value = actionname;
  document.actionsummaryform.description.value = description;

  document.actionsummaryform.needfeedback.value = needfeedback;
  document.actionsummaryform.needsku.value = needsku;
  document.actionsummaryform.valuename.value = valuename;
   document.actionsummaryform.feedbacktype.value = feedbacktype; 
  checkdisabled(needfeedback,needsku);
	
  if (popwindow != null)
    popwindow.close();
}
function checkdisabled(needfeedback,needsku) {
  if(needfeedback == "Y") {
  	document.actionsummaryform.needfeedback.checked = true;
  	
  	document.actionsummaryform.needsku.disabled = false;
  	document.actionsummaryform.feedbacktype.disabled = false;	
  	alert("document.actionsummaryform.needsku" + document.actionsummaryform.needsku)
	if(needsku == "Y") 	document.actionsummaryform.needsku.checked = true;
	else if(isEmpty(needsku)) document.actionsummaryform.needsku.checked = false;
  }
  else if (isEmpty(needfeedback)) {
  
    document.actionsummaryform.needfeedback.checked = false;
    document.actionsummaryform.needsku.checked = false;
  	document.actionsummaryform.feedbacktype.value = "-1";  
  	
    document.actionsummaryform.needsku.disabled = true;
  	document.actionsummaryform.feedbacktype.disabled = true; 
  }
}


function page_add(){
	if(isEmpty(actionsummaryform.actioncode.value)) {
		alert("<%= message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_actionguidecode",false)) %>");
		return;
	}
	if(isEmpty(actionsummaryform.actionname.value)) {
		alert("<%= message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_actionguidename",false)) %>");
		return;
	}
	if(isEmpty(actionsummaryform.stepno.value)) {
		alert("<%= message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_StepNumber",false)) %>");
		return;
	}
 var frm = document.actionsummaryform;
   frm.actionname.value = "add";
   frm.target = "_self";
   isRunning = true;
   frm.submit();
}
function page_getitem(){
	var actioncode = document.actionsummaryform.actioncode.value;
	var datahandler = new  DataHandler();
	datahandler.add_params("actioncode" , actioncode , "string");
	datahandler.add_params("orgid" , "<%=orgid%>" , "integer");
	datahandler.getResult("actionname","document.actionsummaryform.actionname");
	datahandler.getResult("description","document.actionsummaryform.description");
	datahandler.getResult("needfeedback","document.actionsummaryform.needfeedback");
	datahandler.getResult("needsku","document.actionsummaryform.needsku");
	datahandler.getResult("feedbacktype","document.actionsummaryform.feedbacktype");
	datahandler.add_job("j_getactioniteminfo");
	datahandler.runDataHandler();
	checkdisabled(document.actionsummaryform.needfeedback,document.actionsummaryform.needsku);
}

function page_back()
{  
  parent.location.href = "VisitProcessSummary.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode%><%=JspHelper.filterNull( strIsDefault)%>";
}
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(actionsummaryform,actionvalue,orderbyname);
  editform.action = "VisitProcessDetailInfo.jsp?<%= OvalTools.randomURL() %><%=JspHelper.filterNull(strIsDefault)%>&languagecode=<%= strLanguageCode %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();  
}
</script>
	</head>
	<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

		<form name="actionsummaryform" method="post" action="../Dispatcher">
			<input type="hidden" name="pagename" value="p_visitprocessdetailedit">
			<table width="100%" cellspacing="0" cellpadding="0" border="0">
				<tr>
					<td class="summary_top"></td>
				</tr>
				<tr>
					<td>
						<table border="1" cellspacing="0" bordercolorlight="#999999"
							bordercolordark="#FFFFFF" cellpadding="0" width="100%">
							<tr class="deepblue-left">
								<td width="8%" class="title_center">
									<a href="javascript:page_summary('orderby','processcode')"><%= label.getLabelName("L_StepNumber") %></a>
								</td>
								<td width="15%" class="title_center">
									<a href="javascript:page_summary('orderby','processcode')"><%= label.getLabelName("L_actionguidecode") %></a>
								</td>
								<td width="15%" class="title_center">
									<a href="javascript:page_summary('orderby','processcode')"><%= label.getLabelName("L_actionguidename") %></a>
								</td>
								<td width="20%" class="title_center">
									<a href="javascript:page_summary('orderby','processcode')"><%= label.getLabelName("L_Description") %></a>
								</td>
								<td width="15%" class="title_center">
									<a href="javascript:page_summary('orderby','processcode')"><%= label.getLabelName("L_needfeedback ") %></a>
								</td>
								<td width="8%" class="title_center">
									<a href="javascript:page_summary('orderby','createdate')"><%= label.getLabelName("L_IfNeedExpandBySKU") %></a>
								</td>
								<td width="8%" class="title_center">
									<a href="javascript:page_summary('orderby','createdate')"><%= label.getLabelName("L_FeedbackFormat") %></a>
								</td>
							</tr>

							<%
							int i=0; 
							Integer idx = new Integer(-1);
							%>
							<%
                        Vector totalsummary = (Vector) pageContext.getAttribute("visitprocessdetaileditinfo");
                        if (totalsummary == null)
                            totalsummary = new Vector();
                       Vector actionsourcecollection = (Vector) pageContext.getAttribute("actionsourcecollection");
                        if (actionsourcecollection == null)
                            actionsourcecollection = new Vector();
                            boolean bHasChecked = false;
                             String strClassType = new String("");
                            
               %>
							<logic:iterate id="visitprocessdetailinfo" collection="<%=totalsummary%>"
								indexId="orderid">
              
              <%
									            	HashMap tempMap = (HashMap)pageContext.getAttribute("visitprocessdetailinfo");
									            	if(i%2 == 1)
									            	{
									              		strClassType = "td-listrom";
									            	}else{
									              		strClassType = "";
									            	}
									            	i++;
									            	idx = new Integer(i-1);
									          	%>
								<tr onMouseOver="this.className='tr-over'"
									onMouseOut="this.className='<%=JspHelper.filterNull(strClassType)%>'"
									class="<%=JspHelper.filterNull( strClassType )%>">
									<td width="5%">
										<custom:write property="stepno" name="visitprocessdetailinfo" nbsp="true" />
									</td>
									<td>
										<custom:write property="actioncode" name="visitprocessdetailinfo"
											nbsp="true" />
									</td>
									<td>
										<custom:write property="actionname1" name="visitprocessdetailinfo"
											nbsp="true" />
									</td>
									<td>
										<custom:write property="description" name="visitprocessdetailinfo"
											nbsp="true" />
									</td>
									<td class="title_center">
										<custom:write property="needfeedback" name="visitprocessdetailinfo"
											nbsp="true" />
									</td>
									<td class="title_center">
										<custom:write property="needsku" name="visitprocessdetailinfo" nbsp="true" />
									</td>
									<td>
										<custom:write property="valuename" name="visitprocessdetailinfo"
											nbsp="true" />
									</td>
								</tr>
							</logic:iterate>
							<%@ include file="/inc/SummaryAction.inc"%>
						</table>
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td class="summary_top"></td>
							</tr>
							<tr>
								<td class="td_center">
									<%

										String visitprocessid = ((Integer)pageContext.getAttribute("visitprocessid")).toString();

										System.out.println("---"+visitprocessid+"---");
									%>
									<custom:hidden name="newdetailinfo"  property="visitprocessid" value="<%=visitprocessid%>" />
									<custom:hidden name="newdetailinfo"  property="visitprocessactionid" />
									<a onclick="page_back();"><custom:button type="1"
											label="L_Back" imgsrc="new.gif" border="0" style="width:60" />
									</a>
									</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</form>
	</body>
	<script Language="JavaScript">
	function page_delete(){
	 if(nullChecked(document.actionsummaryform.deleteids,"<%=JspHelper.filterNull(totalsummary.size())%>"))
		  {
		    alert("<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD") %>");
		    return;
		  }
  	if ( ! confirm("<%= message.getMessageDesc("ARE_YOU_SURE")%>") ) 
		  return;
		  var frm = document.actionsummaryform;
		  frm.actionname.value = "deletesome";
		  frm.target = "_self";
		  isRunning = true;
		  frm.submit();
	}


</script>
</html>


